public class Demo4 {
    public static void main(String[] args) {
        //匿名内部类的左花括号放在哪个类后面，就是针对哪个类创建匿名内部类
        Thread t = new Thread(new Runnable(){
            public void run(){
                while(true){
                    System.out.println("hello t!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        t.start();
        while(true){
            System.out.println("main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
